package com.dayou.controller;

import com.dayou.bean.SysUser;
import com.dayou.common.core.domain.AjaxResult;
import com.dayou.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class SysLoginController {
    @Autowired
    private ISysUserService sysUserService;
    @GetMapping()
    public String login()
    {
        return "sysUser/login";
    }
    /**
     * 用户登录
     */
    @PostMapping("/login")
    @ResponseBody
    public AjaxResult login(@RequestBody SysUser sysUser)
    {
        return AjaxResult.success("登录成功",sysUserService.login(sysUser));
    }
}
